<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="../js/layui/css/layui.css">
    <script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=gXLkbXzN7kOR22S6iszA2Zfe6yIkK0s4"></script>
</head>
<body>
	<form class="layui-form"  id="form1">
	 	<div class="layui-form-item">
		   	<label class="layui-form-label">手&nbsp;机&nbsp;号</label>
			<div class="layui-input-inline">
			     	<input type="phone" id="phone" name="phone" required lay-verify="required" placeholder="手机号" autocomplete="off" class="layui-input">
			</div>
	   </div>
		<div class="layui-form-item">
		   	<label class="layui-form-label">姓&nbsp;&nbsp;&nbsp;&nbsp;名</label>
			<div class="layui-input-inline">
			     	<input type="name" name="name" id="name" required lay-verify="required" placeholder="客户姓名" autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
		   	<label class="layui-form-label">身&nbsp;份&nbsp;证</label>
			<div class="layui-input-inline">
			     	<input type="idcard" name="idcard" id="idcard" required lay-verify="required" placeholder="身份证" autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
		   	<label class="layui-form-label">车&nbsp;牌&nbsp;号</label>
			<div class="layui-input-inline">
			     	<input type="car" name="car" id="car" required lay-verify="required" placeholder="车牌号" autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
		   	<label class="layui-form-label">性&nbsp;&nbsp;&nbsp;别</label>
			<div class="layui-input-inline">
			      <select name="sex" id="sex">
			      	<option value="男">男</option>
			      	<option value="女">女</option>
			      </select>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-block">
			   <button class="layui-btn" type="button" id="login" lay-filter="formDemo">提交</button>	     
			</div>
		</div>
	<input name="id" id="cid" type="hidden"/>
	</form>
</body>
<script type="text/javascript" src="../js/layui/layui.js"></script>
<script>
	var customer=window.parent.customer[0]; 
 	layui.use(['form','layer','jquery'], function(){
		var form = layui.form, 
		$ = layui.jquery, 
		layer = layui.layer;
		$("#phone").val(customer.phone);
		$("#name").val(customer.name);
		$("#car").val(customer.car);
		$("#cid").val(customer.id);
		$("#idcard").val(customer.idcard);
		$("#sex").find("option:contains('"+customer.sex+"')").attr("selected", true);
		$(document).on('click','#login',function(){
			$.ajax({
				url : '/customer/customerUpd',// 跳转到 action
				type : 'post',
				data :$("#form1").serialize(),
				success : function(data) {
					if(data.code== 200){
						layer.msg(data.msg,function () {
							var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
							parent.layer.close(index);
							window.parent.location.reload();
						});
					}else {
						layer.msg(data.msg,function () {
							var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
							parent.layer.close(index);
							window.parent.location.reload();
						});
					}

				},
				error : function(error) {
					// view("异常！");  
				}
			});
		});
 	});
</script>


</html>